const express = require("express");

const app = express();

const path = require("path");

const bodyPaser = require("body-parser");
const { Pool } = require("pg");
const config = require("./config/config.json");
const pool = new Pool(config);

app.locals.pool = pool;

app.use(bodyPaser.json());
app.use(bodyPaser.urlencoded({ extended: false }));

app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");

// app.use(express.static("assets"));

const index = require("./routers/index.js");
app.use("/", index(app));

app.use("/add", require("./api/add")(app));


const pp = require("./routers/pp.js");
app.use("/pp", pp);

var iconv = require("iconv-lite");
var multer = require("multer");
var fs = require("fs");
 
const server = app.listen(3000, function () {
  console.log("启动成功"); //用pm2 start main.js
});
